package com.hsxc.cdz.monitor.bean.pile.v1_21;

import com.hsxc.cdz.base.util.BytesUtil;

/**
 * 
 * @author 刘力文 充电桩注定上送的注册报文的实体类
 *
 */
public class RegisterPileMsg extends PileMessage {

	private String account; // 注册账号
	private String password; // 账号密码
	private String firstType; // 设备一级类型
	private String secondType; // 设备二级类型
	private String SN; // SN
	private int longitudes; // 经度
	private int latitudes; // 纬度
	private String versionNum; // 软件版本号
	private int pileType;// 充电桩类型
	private int portAmount;// 充电口数量
	private int powerA;// 充电口A的功率 单位：KW
	private int powerB;// 充电口B的功率 单位：KW
	private int powerC;// 充电口C的功率 单位：KW
	private int powerD;// 充电口D的功率 单位：KW

	public String getAccount() {
		return account;
	}

	public void setAccount(String account) {
		this.account = account;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getFirstType() {
		return firstType;
	}

	public void setFirstType(String firstType) {
		this.firstType = firstType;
	}

	public String getSecondType() {
		return secondType;
	}

	public void setSecondType(String secondType) {
		this.secondType = secondType;
	}

	public String getSN() {
		return SN;
	}

	public void setSN(String sN) {
		SN = sN;
	}

	public int getLongitudes() {
		return longitudes;
	}

	public void setLongitudes(int longitudes) {
		this.longitudes = longitudes;
	}

	public int getLatitudes() {
		return latitudes;
	}

	public void setLatitudes(int latitudes) {
		this.latitudes = latitudes;
	}

	public String getVersionNum() {
		return versionNum;
	}

	public void setVersionNum(String versionNum) {
		this.versionNum = versionNum;
	}

	public int getPileType() {
		return pileType;
	}

	public void setPileType(int pileType) {
		this.pileType = pileType;
	}

	public int getPortAmount() {
		return portAmount;
	}

	public void setPortAmount(int portAmount) {
		this.portAmount = portAmount;
	}

	public int getPowerA() {
		return powerA;
	}

	public void setPowerA(int powerA) {
		this.powerA = powerA;
	}

	public int getPowerB() {
		return powerB;
	}

	public void setPowerB(int powerB) {
		this.powerB = powerB;
	}

	public int getPowerC() {
		return powerC;
	}

	public void setPowerC(int powerC) {
		this.powerC = powerC;
	}

	public int getPowerD() {
		return powerD;
	}

	public void setPowerD(int powerD) {
		this.powerD = powerD;
	}

	@Override
	public void getContentFromByte(byte[] result1) {
		byte[] temp;
		System.out.println("充电桩注册报文类里，报文长度："+result1.length);
		System.out.println("充电桩注册报文类里，报文内容："+result1.toString());
		
		temp = BytesUtil.getByte(0, 4, result1);
		this.setAccount(BytesUtil.bcdBytesToStr(temp));

		temp = BytesUtil.getByte(4, 4, result1);
		this.setPassword(BytesUtil.bcdBytesToStr(temp));

		temp = BytesUtil.getByte(8, 1, result1);
		this.setFirstType(BytesUtil.bcdBytesToStr(temp));

		temp = BytesUtil.getByte(9, 1, result1);
		this.setSecondType(BytesUtil.bcdBytesToStr(temp));

		temp = BytesUtil.getByte(10, 8, result1);
		this.setSN(BytesUtil.bcdBytesToStr(temp));

		temp = BytesUtil.getByte(18, 4, result1);
		this.setLongitudes(BytesUtil.bytesToIntDesc(temp));

		temp = BytesUtil.getByte(22, 4, result1);
		this.setLatitudes(BytesUtil.bytesToIntDesc(temp));

		temp = BytesUtil.getByte(26, 2, result1);
		this.setVersionNum(BytesUtil.bcdBytesToStr(temp));

		temp = BytesUtil.getByte(28, 1, result1);
		this.setPileType(BytesUtil.bytesToIntSeq(temp));

		temp = BytesUtil.getByte(29, 1, result1);
		this.setPortAmount(BytesUtil.bytesToIntSeq(temp));

		temp = BytesUtil.getByte(30, 2, result1);
		this.setPowerA(BytesUtil.bytesToIntDesc(temp));

		temp = BytesUtil.getByte(32, 2, result1);
		this.setPowerB(BytesUtil.bytesToIntDesc(temp));

		temp = BytesUtil.getByte(34, 2, result1);
		this.setPowerC(BytesUtil.bytesToIntDesc(temp));

		temp = BytesUtil.getByte(36, 2, result1);
		this.setPowerD(BytesUtil.bytesToIntDesc(temp));

	}

	@Override
	public String toString() {
		return "RegestContent [account=" + account + ", password=" + password + ", firstType=" + firstType
				+ ", secondType=" + secondType + ", SN=" + SN + ", longitudes=" + longitudes + ", latitudes="
				+ latitudes + ", versionNum=" + versionNum + ", getAccount()=" + getAccount() + ", getPassword()="
				+ getPassword() + ", getFirstType()=" + getFirstType() + ", getSecondType()=" + getSecondType()
				+ ", getSN()=" + getSN() + ", getLongitudes()=" + getLongitudes() + ", getLatitudes()=" + getLatitudes()
				+ ", getVersionNum()=" + getVersionNum();
	}

}
